package com.zygh.policeasset.controller;

import com.zygh.policeasset.component.CommonResult;
import com.zygh.policeasset.pojo.RepairAcceptDTO;
import com.zygh.policeasset.service.RepairAcceptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RequestMapping({"/repair-accept"})
@Api(tags = {"日常维修验收管理"})
@RestController
public class RepairAcceptController {
    @Autowired
    RepairAcceptService repairAcceptService;

    @GetMapping({"/findAll"})
    @ApiOperation("获取项目分类列表")
    public Object findAll(@RequestParam(defaultValue = "1", value = "pageNum") int pageNum,
                          @RequestParam(defaultValue = "10", value = "pageSize") int pageSize,
                          @RequestParam(value = "userId",required = false) Integer userId,
                          @RequestParam(value = "status",required = false) Integer status) {
        return this.repairAcceptService.findAll(pageNum,pageSize,userId,status);
    }

    @GetMapping({"/selectById"})
    @ApiOperation("根据id查询")
    public Object selectById(@RequestParam(value = "id") Integer id) {
        return this.repairAcceptService.selectById(id);
    }

    @PostMapping({"/add"})
    @ApiOperation("添加")
    public CommonResult add(@RequestBody RepairAcceptDTO repairAcceptDTO) {
        return this.repairAcceptService.add(repairAcceptDTO);
    }

    @PostMapping({"/update"})
    @ApiOperation("修改")
    public CommonResult update(@RequestBody RepairAcceptDTO repairAcceptDTO) {
        return this.repairAcceptService.update(repairAcceptDTO);
    }

    @DeleteMapping({"/delete/{id}"})
    @ApiOperation("删除")
    public CommonResult delete(@PathVariable Integer id) {
        return this.repairAcceptService.delete(id);
    }
}